// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../components/HomeView.vue';
import MovieView from '../components/MovieView.vue';
import CinemaView from '../components/CinemaView.vue';
import ShowView from '../components/ShowView.vue';
import ManageView from '../components/admin/ManageView.vue';
import UserView from '../components/admin/UserView.vue';
import ProductsView from '../components/admin/ProductsView.vue';
import OrdersView from '../components/admin/OrdersView.vue';
import AdvertisementsView from '../components/admin/AdvertisementsView.vue';
import ServersView from '../components/admin/ServersView.vue';
import ProductDetail from '../components/admin/ProductDetail.vue'; // 导入新组件
import OrderDetail from '../components/admin/OrderDetail.vue';
import EditProduct from '../components/admin/EditProduct.vue';
const router = createRouter({
    history: createWebHistory(process.env.BASE_URL), // 适用于Vue CLI项目
    routes: [
        { path: '/', name: 'home', component: HomeView },
        { path: '/movie', name: 'movie', component: MovieView },
        { path: '/cinema', name: 'cinema', component: CinemaView },
        { path: '/show', name: 'show', component: ShowView },
        {
            path: '/admin',
            component: ManageView,
            children: [
                { path: 'users', component: UserView },
                { path: 'products', component: ProductsView },
                {
                    path: 'products/:title',
                    name: 'productDetailByTitle',
                    component: ProductDetail
                },
                {
                    path: '/product/:productid',
                    name: 'productDetailById',
                    component: ProductDetail
                },
                { path: 'orders', component: OrdersView },
                { path: 'advertisements', component: AdvertisementsView },
                { path: 'servers', component: ServersView },
                {
                    path: '/order/:orderid/:userid',
                    name: 'orderDetail',
                    component: OrderDetail
                },
                {
                    path: '/edit-product/:productid',
                    name: 'editProduct',
                    component: EditProduct
                }
            ]
        }
    ],
    scrollBehavior() {
        return { top: 0 };
    }
});

export default router;
/* eslint-disable */